package com.林子祺.CAT旅游系统.entity.ticket;

import com.林子祺.CAT旅游系统.dao.placemanagement.PlacePull;
import com.林子祺.CAT旅游系统.util.TicketStructure;

import java.util.ArrayList;

public class TicketData {

    static ArrayList<TicketStructure> ts = new ArrayList<>();

    public static void InputData(int ticket_id, int place_id, String time, double cost,int left){
        ts.add(new TicketStructure(ticket_id, place_id, time, cost,left));
    }

    public static boolean OutputData(int number){
        if(number < ts.size()) {
            TicketStructure p = ts.get(number);
            CurrentTicketData.Ticket_id = p.getTicket_id();
            CurrentTicketData.Place_id = p.getPlace_id();
            CurrentTicketData.Time = p.getTime();
            CurrentTicketData.cost = p.getCost();
            CurrentTicketData.left = p.getLeft();
            return true;
        }
        else
            return false;
    }

    public static void Refresh(){

        ts.removeAll(ts);

    }

}
